package com.example.xsssglxt.mapper;


import com.example.xsssglxt.entity.Admin;
import com.example.xsssglxt.entity.DomiteryManage;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.JdbcType;

import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
@Mapper
public interface SushemanagerMapper {


        @Select("select * from sushe_manager where name like concat('%' ,#{name},'%') AND number like concat('%' ,#{number},'%') limit #{pageNum},#{pageSize}")
        @Results(value =  {
                @Result(column = "create_time", property = "create_time", javaType = LocalDateTime.class, jdbcType = JdbcType.TIMESTAMP),
                @Result(column = "update_time", property = "update_time", javaType = LocalDateTime.class, jdbcType = JdbcType.TIMESTAMP)
        })
        List<DomiteryManage> selectPage(Integer pageNum, Integer pageSize, String name, String number);
        @Select("select count(*) from sushe_manager where name like concat('%' ,#{name},'%') AND number like concat('%' ,#{number},'%')")
        Integer selectTotal(String name,String number);
        @Select("select * from sushe_manager")
        @Results(value =  {
                @Result(column = "create_time", property = "create_time", javaType = LocalDateTime.class, jdbcType = JdbcType.TIMESTAMP),
                @Result(column = "update_time", property = "update_time", javaType = LocalDateTime.class, jdbcType = JdbcType.TIMESTAMP)
        })
        List<DomiteryManage> selectlist();
        @Select("select * from admin")
        @Results(value =  {
                @Result(column = "create_time", property = "create_time", javaType = LocalDateTime.class, jdbcType = JdbcType.TIMESTAMP),
                @Result(column = "update_time", property = "update_time", javaType = LocalDateTime.class, jdbcType = JdbcType.TIMESTAMP)
        })
        List<Admin> selectlist1();
        @Insert("Insert into sushe_manager(name,password,sex,number) VALUES(#{name},#{password},#{sex},#{number})")
        int insert(DomiteryManage domiteryManage);
        @Update("Update sushe_manager set name=#{name},password=#{password},sex=#{sex},number=#{number} where id=#{id}")
        int updatexs(DomiteryManage domiteryManage);
        @Delete("delete from sushe_manager where id=${id}")
        int deletxs(@Param("id") Integer id);
    }


